# 7  随机生成20个学生的成绩; 判断这20个学生成绩的等级; 用函数来实现;
#     A---成绩>=90;
#     B-->成绩在 [80,90)
#     C-->成绩在 [70,80)
#     D-->成绩<70
import random

scores = [random.randint(0, 100) for i in range(20)]
print(scores)

def judge(scores):
    level = []
    for score in scores:
        if score >= 90:
            level.append("A")
        elif 80 <= score < 90:
            level.append("B")
        elif 70 <= score < 80:
            level.append("C")
        else:
            level.append("D")
    return level

print(judge(scores))

